package com.pc.admin.exception;


import com.pc.admin.eunms.ErrorEnum;

/**
 * 策略异常
 *
 * @author <a href="https://www.lvfeiy.top">lfy</a>
 * @date 2023/6/23 21:38
 */
public class NoSuchStrategyException extends RuntimeException{
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    protected Integer errorCode;

    /**
     * 错误信息
     */
    protected String errorMsg;

    public NoSuchStrategyException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public NoSuchStrategyException(Integer errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    public NoSuchStrategyException(Integer errorCode, String errorMsg, Throwable cause) {
        super(errorMsg, cause);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    public NoSuchStrategyException(ErrorEnum.BusinessErrorEnum errorEnum) {
        super(errorEnum.getErrorMsg());
        this.errorCode = errorEnum.getCode();
        this.errorMsg = errorEnum.getErrorMsg();
    }
    @Override
    public String getMessage() {
        return errorMsg;
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
